package com.ruoyi.credit.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.credit.mapper.BaseRulesMapper;
import com.ruoyi.credit.domain.BaseRules;
import com.ruoyi.credit.service.IBaseRulesService;
import com.ruoyi.common.core.text.Convert;

/**
 * 制度规则Service业务层处理
 * 
 * @author zhulei
 * @date 2022-03-10
 */
@Service
public class BaseRulesServiceImpl implements IBaseRulesService 
{
    @Autowired
    private BaseRulesMapper baseRulesMapper;

    /**
     * 查询制度规则
     * 
     * @param ruleId 制度规则主键
     * @return 制度规则
     */
    @Override
    public BaseRules selectBaseRulesByRuleId(Long ruleId)
    {
        return baseRulesMapper.selectBaseRulesByRuleId(ruleId);
    }

    /**
     * 查询制度规则列表
     * 
     * @param baseRules 制度规则
     * @return 制度规则
     */
    @Override
    public List<BaseRules> selectBaseRulesList(BaseRules baseRules)
    {
        return baseRulesMapper.selectBaseRulesList(baseRules);
    }

    /**
     * 新增制度规则
     * 
     * @param baseRules 制度规则
     * @return 结果
     */
    @Override
    public int insertBaseRules(BaseRules baseRules)
    {
        baseRules.setCreateTime(DateUtils.getNowDate());
        return baseRulesMapper.insertBaseRules(baseRules);
    }

    /**
     * 修改制度规则
     * 
     * @param baseRules 制度规则
     * @return 结果
     */
    @Override
    public int updateBaseRules(BaseRules baseRules)
    {
        baseRules.setUpdateTime(DateUtils.getNowDate());
        return baseRulesMapper.updateBaseRules(baseRules);
    }

    /**
     * 批量删除制度规则
     * 
     * @param ruleIds 需要删除的制度规则主键
     * @return 结果
     */
    @Override
    public int deleteBaseRulesByRuleIds(String ruleIds)
    {
        return baseRulesMapper.deleteBaseRulesByRuleIds(Convert.toStrArray(ruleIds));
    }

    /**
     * 删除制度规则信息
     * 
     * @param ruleId 制度规则主键
     * @return 结果
     */
    @Override
    public int deleteBaseRulesByRuleId(Long ruleId)
    {
        return baseRulesMapper.deleteBaseRulesByRuleId(ruleId);
    }
}
